<%--
    Document   : RateContent
    Created on : May 20, 2010, 11:47:13 PM
    Author     : andrei
--%>

<%@page import="java.io.*" %>
<%@page import="java.net.*"%>
<%@page import="entities.ContentEntity" %>
<%@page import="entities.ContentStatisticEntity" %>
<%@page import="entities.RateEntity" %>

<%ContentEntity content = (ContentEntity)request.getAttribute("content");%>
<%ContentStatisticEntity statistic = (ContentStatisticEntity)request.getAttribute("statistic");%>
<%RateEntity rating = (RateEntity)request.getAttribute("rating");%>

<form id="content_rate_post_form" action="<% out.print(request.getContextPath()); %>/content/rate" method="POST">
    <table>
        <tr>
            <td>
                <input class="hover-star" type="radio" value="1" title="Very poor" name="rate" <% if(statistic != null && statistic.getRating() > 0.0 &&  statistic.getRating() <= 1.0) out.print("checked=\"checked\""); %>/>
            </td>
            <td>
                <input class="hover-star" type="radio" value="2" title="Poor" name="rate" <% if(statistic != null && statistic.getRating() > 1.0 &&  statistic.getRating() <= 2.0) out.print("checked=\"checked\""); %>/>
            </td>
            <td>
                <input class="hover-star" type="radio" value="3" title="OK" name="rate"<% if(statistic != null && statistic.getRating() > 2.0 &&  statistic.getRating() <= 3.0) out.print("checked=\"checked\""); %> />
            </td>
            <td>
                <input class="hover-star" type="radio" value="4" title="Good" name="rate"<% if(statistic != null && statistic.getRating() > 3.0 &&  statistic.getRating() <= 4.0) out.print("checked=\"checked\""); %> />
            </td>
            <td>
                <input class="hover-star" type="radio" value="5" title="Very Good" name="rate" <% if(statistic != null && statistic.getRating() > 4.0) out.print("checked=\"checked\""); %>/>
            </td>
        </tr>
        <input type="hidden" value="<%= content.getCid()%>" name="cid" />
        <input type="hidden" value="submitted" name="submitted" />
    </table>
</form>
<br>
<% if (rating != null){
    out.print("<div>Your rate for this content is "+rating.getRate_value()+"</div>");
} else {
    out.print("<div>You have not rated this content yet.</div>");
} %>


